home *** CD-ROM | disk | FTP | other *** search
- // -[Keep_Heading]-
-
-
- // -[Copyright_Mesg]-
- // --------------------------------------------------------------- //
- // (c) Copyright 1993-1994. Step Ahead Software Pty Limited. All rights reserved.
- // Class Name : Circle
- // Designer : Example Writer
- // Filename : CIRCLE.cpp
- // Description :
- // Circle objects are objects in the system that are shown on the screen
- // as a circle at a location X,Y with a size specified by Radius. Their
- // colour is determined by the protected Colour member in their base
- // class Shape.
- // --------------------------------------------------------------- //
-
-
- // ==================================================
- // = LIBRARY
- // Step 3 Graphics Example
- // = FILENAME
- // CIRCLE.cpp
- // = RCSID
- // $Id$
- // = AUTHOR
- // Example Writer
- // = COPYRIGHT
- // (c) Copyright 1993-1994. Step Ahead Software Pty Limited. All rights reserved.
- // ==================================================
-
- #include "CIRCLE.h"
-
-
- // -[Keep_cpp_Extras]-
-
-
- // -[Module_Function_Decs]-
-
-
- // -[Module_Data_Decs_Def]-
-
-
- // -[Global_Data_Defs]-
-
-
- // -[Static_Member_Data_Defs]-
-
-
- // -[Function_Defs]-
-
- void
- Circle::write(Ropstream os)
- {
- // Call to base class write functions
- Shape::write(os);
- os << Radius;
- }
-
- Pvoid
- Circle::read(Ripstream is)
- {
- // Call to base class read functions
- Shape::read(is);
- is >> Radius;
- return this;
- }
-
- // Constructs the object before a stream input operation
- Circle::Circle(StreamableInit s)
- : Shape(s)
-
- {
- }
-
- // Unique class ID
- classType
- Circle::isA() const
- {
- return CircleClass;
- }
-
- // Output Class Info
- void
- Circle::printOn(Rostream outputStream) const
- {
- }
-
- // Class Name
- char *
- Circle::nameOf() const
- {
- return "Circle";
- }
-
- // Returns a hash value
- hashValueType
- Circle::hashValue() const
- {
- return 0;
- }
-
- // Tests Equality
- int
- Circle::isEqual(const Object& testObject) const
- {
- return FALSE;
- }
-
- // Constructs a circle object with the given parameters.
- Circle::Circle(int InitX, int InitY, int InitRadius)
- : Shape(InitX, InitY)
- {
- Radius = InitRadius;
- Width = Radius * 2;
- Height = Radius * 2;
- Colour = RGB(255, 0, 0);
- }
-
- // Draws the circle.
- void
- Circle::Show(HDC hDC)
- {
- HBRUSH hBrush = CreateSolidBrush(Colour);
- HBRUSH hOldBrush;
-
- hOldBrush = SelectObject(hDC, hBrush);
-
- // Draw the circle
- Ellipse(hDC, X, Y, X + Radius * 2, Y + Radius * 2);
-
- SelectObject(hDC, hOldBrush);
- DeleteObject(hBrush);
- }
-
-
- // -[Persistent]-
- // OWL 1.0 streamability
- PTStreamable Circle::build()
- {
- return new Circle(streamableInit);
- }
-
- const Pchar Circle::streamableName() const
- {
- return "Circle";
- }
-
- TStreamableClass RegCircle("Circle", Circle::build,
- __DELTA(Circle));
-